package com.kfm.springboot.controller;

import com.kfm.springboot.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

/**
 *   /user  GET  user 页面
 *   /user/{id} GET 获取某个用户的信息
 *   /user POST
 */
@RestController
@RequestMapping("/sys/user")
public class SysUserController {

    @Autowired
    private SysUserService sysUserService;

    @GetMapping
    public ModelAndView index(@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
                              @RequestParam(name = "pageSize", defaultValue = "5") Integer pageSize){
        ModelAndView modelAndView = new ModelAndView("system/user/index");
        modelAndView.addObject("page", sysUserService.list(pageNum, pageSize));
        return modelAndView;
    }


}
